// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_PROD_TECHNIC
// * CreateDate    : 2013-08-28 11:00:57
// * Creater       : CodeSmith
// * LastChangeDate: 2013-08-28 11:00:57
// * LastChanger   : 2013-08-28 11:00:57
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;

namespace ESOL.Business.Prod
{
/// <summary>
    /// ProdTechnic
    /// </summary>
    public partial class ProdTechnicBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objProdTechnicEntity">Entity</param>
        /// <returns>Entity</returns>
        public static ProdTechnicEntity GetProdTechnic(ProdTechnicEntity objProdTechnicEntity)
        {
            return DataAccess.SelectSingle<ProdTechnicEntity>(objProdTechnicEntity);
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objProdTechnicEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertProdTechnic(ProdTechnicEntity objProdTechnicEntity)
        {
            return DataAccess.Insert(objProdTechnicEntity);
        }

        public static bool InsertProdTechnic(List<ProdTechnicEntity> objProdTechnicEntityList)
        {
            return DataAccess.Insert(objProdTechnicEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objProdTechnicEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateProdTechnic(ProdTechnicEntity objProdTechnicEntity)
        {
            return DataAccess.Update(objProdTechnicEntity);
        }

        public static bool UpdateProdTechnic(List<ProdTechnicEntity> objProdTechnicEntityList)
        {
            return DataAccess.Update<ProdTechnicEntity>(objProdTechnicEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objProdTechnicEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteProdTechnic(ProdTechnicEntity objProdTechnicEntity)
        {
            return DataAccess.Delete(objProdTechnicEntity);
        }

        public static bool DeleteProdTechnic(List<ProdTechnicEntity> objProdTechnicEntityList)
        {
            return DataAccess.Delete<ProdTechnicEntity>(objProdTechnicEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetProdTechnicAll()
        {
            return DataAccess.SelectAllDataSet<ProdTechnicEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<ProdTechnicEntity> GetProdTechnicAllList()
        {
            return DataAccess.SelectAll<ProdTechnicEntity>();
        }
        #endregion

        public static DataSet GetAllDsBySql(string sql)
        {
            return DataAccess.SelectDataSet(sql);
        }


        public static string CheckProdTechnicUsed(ProdTechnicEntity entity)
        {
           List<BomTechnicItemEntity> technicItemList= DataAccess.Select<BomTechnicItemEntity>(new BomTechnicItemEntity { TechnicId = entity.TechnicId });
           if (technicItemList == null || technicItemList.Count == 0) return "";
           return technicItemList[0].BomTechnicId;
        }

	}
	
	
}	

